package com.sec.bnjey.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.sec.bnjey.utils.RbLog;

public class OBDDbHelper extends SQLiteOpenHelper {

	private static final String TAG = "OBDDbHelper";

	public OBDDbHelper(Context context) {
		super(context, "Mileage49.db", null, 1);
	}

	public void onCreate(SQLiteDatabase db) {

		String sqlQuery = "CREATE TABLE dic(" + "vid INTEGER,"
				+ "start INTEGER PRIMARY KEY," + "end INTEGER,"
				+ "mileage INTEGER," + "max_speed INTEGER,"
				+ "sup_battery INTEGER," + "max_battery INTEGER,"
				+ "min_battery INTEGER," + "avg_battery INTEGER,"
				+ "sup_temp INTEGER," + "max_temp INTEGER,"
				+ "avg_temp INTEGER," + "sup_oil INTEGER," + "max_oil INTEGER,"
				+ "avg_oil INTEGER," + "sup_fuel INTEGER," + "fuel INTEGER,"
				+ "sup_consume INTEGER," + "consume INTEGER,"
				+ "accelCnt INTEGER," + "decelCnt INTEGER," + "maxrpm INTEGER,"
				+ "avg_speed INTEGER," + "idle INTEGER," + "title BLOB(66)"
				+ ")";
		RbLog.d(TAG, sqlQuery);
		db.execSQL(sqlQuery);

	}

	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS dic");
		onCreate(db);
	}
}